﻿using System.ComponentModel.DataAnnotations;
using Microsoft.Practices.Prism.StoreApps;

namespace ValidationQuickStart.Models
{
    public class DogInfo : ValidatableBindableBase
    {
        private string _name;

        private const string RegexPattern = @"\A\p{L}+([\p{Zs}\-][\p{L}]+)*\z";

        [Required(ErrorMessageResourceType = typeof(ErrorMessagesHelper), ErrorMessageResourceName = "DogNameRequired")]
        [RegularExpression(RegexPattern, ErrorMessageResourceType = typeof(ErrorMessagesHelper), ErrorMessageResourceName = "DogNameRegex")]
        [StringLength(2, ErrorMessageResourceType = typeof(ErrorMessagesHelper), ErrorMessageResourceName = "DogNameRequired")]
        public string Name
        {
            get { return _name; }
            set { SetProperty(ref _name, value); }
        }

    }
}
